<?php 
	if ((!defined("ADMIN-AREA")) || (!in_array($_GET['showview'],$_SESSION['access']))) {
		die("No data");
	} else {
		unset($_SESSION['access']);
	}

	include_once "modul/funct_stat.php";
	
	if (ACT=="edit") {
		$kode = (int) $_GET['kode'];
		$sql1 = "SELECT * FROM kota WHERE idx='".$kode."' LIMIT 1";
		$qry1 = mysql_query($sql1);
		while ($row1 = mysql_fetch_object($qry1)) {
			$nama_propinsi = $row1->id_propinsi;
			$nama_kota = $row1->nama_kota;
		};
		
		$form_stat = "Edit";
	} else {
		$header_cX = "Insert Header or short description, No HTML tag allowed, Every script tag will be ignored";
		$form_stat = "Input";
	}
	
	if ((ACT=="tambah") || (ACT=="edit")) {
?>
<form name="form1" method="post" action="<?php echo $path; ?>ver_kota.php?show=<?php echo $_GET['show']; ?>&amp;showview=<?php echo $_GET['showview']; ?>" onsubmit="MM_validateForm('<?php echo $CITY_PROP; ?>','','R','<?php echo $CITY_NAME; ?>','','R');return document.MM_returnValue">
  <table width="75%" border="0" align="center" cellpadding="4" cellspacing="1">
    <tr valign="top">
      <td valign="middle" nowrap="nowrap"><div align="right"><?php echo $CITY_PROP; ?></div></td>
      <td valign="middle"><div align="center">:</div></td>
      <td valign="middle"><div align="left">
        <select name="nama_propinsi" id="<?php echo $CITY_PROP; ?>">
		<?php
			$sqlQ = "SELECT * FROM propinsi";
			$qryQ = mysql_query($sqlQ);
			while ($rowQ = mysql_fetch_object($qryQ)) {
		?>
          <option value="<?php echo $rowQ->id_propinsi; ?>" <?php if ($rowQ->id_propinsi==$nama_propinsi) echo "selected"; ?>><?php echo $rowQ->nama_propinsi.' ('.$rowQ->id_propinsi.')'; ?></option>
		<?php
			}
		?>
        </select>
        </div></td>
    </tr>
    <tr valign="top"> 
      <td width="21%" valign="middle" nowrap> <div align="right"><?php echo $CITY_NAME; ?></div></td>
      <td width="5%" valign="middle"> <div align="center">:</div></td>
      <td width="74%"> <div align="left"> 
          <input name="nama_kota" type="text" id="<?php echo $CITY_NAME; ?>" value="<?php echo $nama_kota; ?>" size="30" class="input-title" />
        </div></td>
    </tr>
    <tr valign="top"> 
      <td> <div align="right"></div></td>
      <td> <div align="center"></div></td>
      <td> <div align="left">
        <input type="submit" name="submit" id="submit" value="<?php echo $DEV_CTRL_SUBMIT; ?>" />
          <input type="reset" name="Reset" value="<?php echo $DEV_CTRL_RESET; ?>" />
<input name="act_ver" type="hidden" id="act_ver" value="<?php echo strtolower($form_stat); ?>">
          <input name="kode" type="hidden" id="kode" value="<?php echo $kode; ?>">
      </div></td>
    </tr>
  </table>
</form>
<?php
	} else {
		echo $queryData->cari_form($CITY_SEARCH);
		$caridata = $queryData->cari_padaku("id_propinsi","nama_kota");
		if (isset($_SESSION['isroot'])) {
			$sql1 = "SELECT * FROM kota WHERE 1 ".$caridata." ORDER BY idx DESC LIMIT ".$limitdown.",10 ";	
		} else {
			$sql1 = "SELECT * FROM kota WHERE 1 ".$caridata." ORDER BY idx DESC LIMIT ".$limitdown.",10";	
		}
?>
<table align="center" cellpadding="4" cellspacing="2" class="imagesSUB">
  <tr> 
    <th width="200" height="30" class="imagesSUB"><div align="center"><?php echo $CITY_PROP; ?></div></th>
    <th width="250" class="imagesSUB"><div align="center"><?php echo $CITY_NAME; ?></div></th>
    <th width="50" class="imagesSUB"><div align="center"><?php echo $DEV_ACTION; ?></div></th>
  </tr>
<?php
	
		$qry1 = mysql_query($sql1);
		$numrow = mysql_num_rows($qry1);
		$num = 1;
		$x = 1;
		if ($numrow==0) {
			echo '<tr><th colspan="3">'.$DEV_NO_DATA.'</th></tr>';
		} else {
			while ($row1 = mysql_fetch_object($qry1)) {
				$data = $x % 2;
				if ($data==0) {
					$dataX = "ganjil";
				} else {
					$dataX = "genap";
				} 
?>
  <tr valign="top" class="<?php echo $dataX; ?>" onmouseover="setBG('bg<?php echo $x; ?>','#FFFFDD')" onmouseout="setBG('bg<?php echo $x; ?>','')" id="bg<?php echo $x; ?>"> 
    <td><div align="left"><?php $a = $queryData->selek1("propinsi","id_propinsi='".$row1->id_propinsi."'");echo $a->nama_propinsi.' ('.$a->id_propinsi.')'; ?></div>    </td>
    <td><div align="left"><?php echo $row1->nama_kota; ?></div></td>
        <?php echo $queryData->ctrl_data('','index.php?show='.SHOW.'&showview='.SHOWVIEW.'&act=edit&kode='.$row1->idx,$path.'ver_kota.php?show='.SHOW.'&amp;showview='.SHOWVIEW.'&amp;kode='.$row1->idx.'&amp;act_ver=Hapus'); ?>
</tr>
<?php 
                $num++;
                $x++;
            }
        }
?>
</table>
<div align="center"><?php echo $queryData->next_prev($num,$pages_syarat,$limitdown); ?></div>
<?php
	}
?>